<script type="text/javascript">
<!--

//-->

function send_form(id){
	$('#update_status_'+id).submit();
}
function send_form2(id){
	$('#delivery_shop_'+id).submit();
}
</script>

<div class="body" style="text-align: center;">
	<table width="650" align="center">
		<tr style="background: white;">
			
			<td>Post</td>
			<td>Community</td>
			<td>&nbsp;</td>
			<td>Status</td>
			<td>Limitation</td>
			<td>Livraison</td>
		</tr>
		<?php foreach ($coms as $c):?>
		<tr style="background: skyblue;">
			
			<td><?=$c->code?></td>
			<td><?=$c->name?></td>
			<td><?php if($c->status == !null){?><img src="<?=base_url()?>/resources/imgs/block_yes.png" height="15" alt="activé" title="activé"> <?php }else{?><img src="<?=base_url()?>/resources/imgs/block_no.png" height="15" alt="non activé" title="non activé"> <?php }?></td>
			<form actions="" method="post" id="update_status_<?=$c->id?>" enctype="multipart/form-data">
			<td>
					<select name="status" onchange="send_form(<?=$c->id?>)">
						<option value="active"
						<?php if($c->status=='active'){echo 'selected="selected"';}?>>activé</option>
						<option value="null"
						<?php if($c->status==null){echo 'selected="selected"';}?>>no
							activé</option>
					</select> <input type="hidden" name="id" value="<?=$c->id?>">


				
			</td>
			<td>
			<select name="limit_price" onchange="send_form(<?=$c->id?>)">
			<?php for($i=18;$i<51;$i++){?>
			<option value="<?=$i?>" <?php if($i==$c->limit_price){echo 'selected="selected"';}?>><?=$i?> €</option>
			<?php }?>
			
			</select>
			</td>
			<td>
			<select name="shop_id" onchange="send_form(<?=$c->id?>)">
			<?php foreach ($shop as $s):?>
			<option value="<?=$s->id?>" <?php if($s->id == $c->delivery){ echo 'selected="selected"';}?>><?=$s->shop_name?></option> 
			<?php endforeach;?>
			</select>
			
			
			</td>
			</form>
		</tr>
		<?php endforeach;?>
	</table>


</div>
<br><br>
	</body>
</html>